<template>
    <van-nav-bar title="添加商品" left-arrow @click-left="handleLeft" v-if="!showSupplierName">
    </van-nav-bar>
    <div class="add_product" v-if="!showSupplierName">
        <div class="add_supplier-background">
            <van-form @submit="onSubmit" validate-first scroll-to-error>
                <van-cell-group inset>
                    <van-field input-align="right" error-message-align="right" name="supplierName" label="供应商名称"
                        v-model="addQueryParams.supplierName" is-link readonly placeholder="请选择" required
                        @click="showSupplierName = true" :rules="[
                            {
                                required: true,
                                trigger: 'onBlur',
                                message: '请选择供应商名称',
                            },
                        ]" />
                </van-cell-group>
                <van-cell-group inset>
                    <van-field input-align="right" error-message-align="right" name="styleName"
                        @input="(e) => { forbidRule(e, 'styleName', 'blank') }" label="商品名称"
                        v-model="addQueryParams.styleName" placeholder="请输入" required maxlength="50" :rules="[
                            { required: true, trigger: 'onBlur', message: '请输入商品名称' }
                        ]" />
                </van-cell-group>
                <van-cell-group inset>
                    <van-field name="productCategoryName" label="商品类目" v-model="addQueryParams.productCategoryName"
                        is-link readonly input-align="right" error-message-align="right" placeholder="请选择"
                        @click="show = true" required :rules="[
                            { required: true, trigger: 'onBlur', message: '请选择商品类目' },
                        ]" />
                    <div class="cascaderShade" v-if="cascaderShade"></div>
                    <van-popup v-model:show="show" round position="bottom">
                        <van-cascader v-model="cascaderValue" title="请选择商品类目" :options="options" @close="show = false"
                            @finish="onFinish" />
                    </van-popup>
                </van-cell-group>
                <van-cell-group inset>
                    <van-field name="brandName" input-align="right" error-message-align="right" label="品牌"
                        v-model="addQueryParams.brandName" placeholder="请输入" maxlength="50" :rules="[
                            { required: false, trigger: 'onBlur', message: '请输入品牌名称' },
                            {
                                validator: validatorNumberBrand,
                                message: '请输入正确的品牌名称',
                            },
                        ]" />
                </van-cell-group>
                <formNumberKeyboard :formRef="formRef" name="styleCode" label="69码"
                    v-model:keyValue="addQueryParams.styleCode" placeholder="请输入" :rules="[
                        {
                            validator: validatorStyleCode,
                            message: '请输入正确内容',
                        },
                    ]">
                    <!-- <van-checkbox-group v-model="checked" shape="square">
                        <van-checkbox name="code">无码</van-checkbox>
                    </van-checkbox-group> -->
                </formNumberKeyboard>
                <van-cell-group inset>
                    <van-field input-align="right" error-message-align="right" name="tradeMode" label="贸易方式"
                        v-model="addQueryParams.tradeMode" is-link readonly placeholder="请选择"
                        @click="showTradeMode = true" required :rules="[
                            { required: true, trigger: 'onBlur', message: '请选择贸易方式' },
                        ]" />
                    <van-popup v-model:show="showTradeMode" position="bottom">
                        <van-picker :columns="tradeModeColumns" @confirm="onConfirmTradeMode"
                            @cancel="showTradeMode = false" />
                    </van-popup>
                </van-cell-group>
                <formNumberKeyboard :formRef="formRef" name="tax" label="平台扣点" v-model:keyValue="addQueryParams.tax"
                    placeholder="请输入" required :rules="[
                        { required: true, trigger: 'onBlur', message: '请输入平台扣点' },
                        {
                            validator: validatorcommission,
                            message: '请输入正确内容：整数或者保留两位小数',
                        },
                    ]" extraKey=".">
                    <div style="display: flex;align-items: center;">
                        <span style="margin-right: 5px;">%</span>
                        <PointButton @onClick="isPoint = true" />
                    </div>
                </formNumberKeyboard>
                <div>
                    <div class="mechanism_title">机制一</div>
                    <van-cell-group inset>
                        <van-field input-align="right" error-message-align="right" name="cooperationMode" label="合作方式"
                            v-model="addQueryParams.cooperationMode" is-link readonly placeholder="请选择"
                            @click="showCooperationMode = true" required :rules="[
                                { required: true, trigger: 'onBlur', message: '请选择合作方式' },
                            ]" />
                        <van-popup v-model:show="showCooperationMode" position="bottom">
                            <van-picker title="合作方式" :columns="cooperationModeColumns"
                                @confirm="onConfirmcooperationMode" @cancel="showCooperationMode = false" />
                        </van-popup>
                    </van-cell-group>
                    <formNumberKeyboard :formRef="formRef" v-if="addQueryParams.cooperationMode == '分佣'" name="price"
                        label="售价" v-model:keyValue="addQueryParams.price" placeholder="请输入" required :rules="[
                            { required: true, trigger: 'onBlur', message: '请输入售价' },
                            {
                                validator: validatorNumber,
                                message: '请输入正确内容：整数或者保留两位小数',
                            },
                        ]" extraKey="." />
                    <van-cell-group inset v-if="addQueryParams.cooperationMode == '分佣'">
                        <van-field input-align="right" error-message-align="right" name="costPrice" label="成本"
                            v-model="addQueryParams.costPrice" readonly required placeholder="请输入" />
                    </van-cell-group>
                    <formNumberKeyboard v-else :formRef="formRef" name="costPrice" label="成本"
                        v-model:keyValue="addQueryParams.costPrice" placeholder="请输入"
                        :required="addQueryParams.cooperationMode == '供货'" :rules="[
                            {
                                validator: validatorNumbercostPrice,
                                message: '请输入正确内容：整数或者保留两位小数',
                            },
                        ]" extraKey="." />
                    <formNumberKeyboard :formRef="formRef" v-if="addQueryParams.cooperationMode == '分佣'"
                        name="commission" label="佣金" v-model:keyValue="addQueryParams.commission" placeholder="请输入"
                        required :rules="[
                            { required: true, trigger: 'onBlur', message: '请输入佣金' },
                            {
                                validator: validatorcommission,
                                message: '请输入正确内容：整数或者保留两位小数',
                            },
                        ]" extraKey=".">
                        %
                    </formNumberKeyboard>
                    <formNumberKeyboard :formRef="formRef" v-if="addQueryParams.cooperationMode == '分佣'"
                        name="brokerage" label="补充佣金" v-model:keyValue="addQueryParams.brokerage" placeholder="请输入"
                        :rules="[
                            {
                                validator: validatorbrokerage,
                                message: '请输入正确内容：整数或者保留两位小数',
                            },
                        ]" extraKey=".">
                        %
                    </formNumberKeyboard>
                    <van-cell-group inset>
                        <van-field input-align="right" error-message-align="right" name="liveStreamingMechanism"
                            label="机制" maxlength="12" v-model="addQueryParams.liveStreamingMechanism"
                            @input="(e) => { forbidRule(e, 'liveStreamingMechanism', 'blank') }" placeholder="请输入"
                            required :rules="[
                                { required: true, trigger: 'onBlur', message: '请输入机制' },
                            ]" />
                    </van-cell-group>
                    <div class="add_mechanism" @click="addMechanism(2)" v-if="mechanismArr.length == 1">
                        <van-image :src="tianjia"></van-image>
                        <div class="title">添加机制</div>
                    </div>
                </div>
                <div v-if="mechanismArr.indexOf(2) !== -1">
                    <div class="mechanism_title">
                        机制二
                        <div class="delete_mechanism" @click="deleteMechanism(2)">
                            <van-image :src="shanchu"></van-image>
                            <div class="title">删除机制</div>
                        </div>
                    </div>
                    <van-cell-group inset>
                        <van-field input-align="right" error-message-align="right" name="cooperationMode2" label="合作方式"
                            v-model="addQueryParams.cooperationMode2" is-link readonly placeholder="请选择" clearable
                            @click="showCooperationMode2 = true" :rules="[
                                { required: false, trigger: 'onBlur', message: '请选择合作方式' },
                            ]" />
                        <van-popup v-model:show="showCooperationMode2" position="bottom">
                            <van-picker title="合作方式" :columns="cooperationModeColumns"
                                @confirm="onConfirmcooperationMode2" @cancel="showCooperationMode2 = false" />
                        </van-popup>
                    </van-cell-group>
                    <formNumberKeyboard :formRef="formRef" v-if="addQueryParams.cooperationMode2 == '分佣'" name="price2"
                        label="售价" v-model:keyValue="addQueryParams.price2" placeholder="请输入"
                        :required="addQueryParams.cooperationMode2 == '分佣'" :rules="[
                            { validator: validators2, message: '请输入售价' },
                            {
                                validator: validatorNumber2,
                                message: '请输入正确内容：整数或者保留两位小数',
                            },
                        ]" extraKey="." />
                    <van-cell-group inset v-if="addQueryParams.cooperationMode2 == '分佣'">
                        <van-field input-align="right" error-message-align="right" name="costPrice2" label="成本"
                            v-model="addQueryParams.costPrice2" readonly required placeholder="请输入" />
                    </van-cell-group>
                    <formNumberKeyboard v-else :formRef="formRef" name="costPrice2" label="成本"
                        v-model:keyValue="addQueryParams.costPrice2" placeholder="请输入"
                        :required="addQueryParams.cooperationMode2 == '供货'" :rules="[
                            {
                                validator: validatorNumbercostPrice2,
                                message: '请输入正确内容：整数或者保留两位小数',
                            },
                        ]" extraKey="." />
                    <formNumberKeyboard :formRef="formRef" v-if="addQueryParams.cooperationMode2 == '分佣'"
                        name="commission2" label="佣金" v-model:keyValue="addQueryParams.commission2" placeholder="请输入"
                        :required="addQueryParams.cooperationMode2 == '分佣'" :rules="[
                            { validator: validators2, message: '请输入佣金' },
                            {
                                validator: validatorcommission2,
                                message: '请输入正确内容：整数或者保留两位小数',
                            },
                        ]" extraKey=".">
                        %
                    </formNumberKeyboard>
                    <formNumberKeyboard :formRef="formRef" v-if="addQueryParams.cooperationMode2 == '分佣'"
                        name="brokerage2" label="补充佣金" v-model:keyValue="addQueryParams.brokerage2" placeholder="请输入"
                        :rules="[
                            {
                                validator: validatorbrokerage2,
                                message: '请输入正确内容：整数或者保留两位小数',
                            },
                        ]" extraKey=".">
                        %
                    </formNumberKeyboard>
                    <van-cell-group inset>
                        <van-field input-align="right" error-message-align="right" name="liveStreamingMechanism2"
                            label="机制" maxlength="12" v-model="addQueryParams.liveStreamingMechanism2"
                            :required="!!addQueryParams.cooperationMode2"
                            @input="(e) => { forbidRule(e, 'liveStreamingMechanism2', 'blank') }" placeholder="请输入"
                            :rules="[
                                { validator: validators2, message: '请输入机制' },
                            ]" />
                    </van-cell-group>
                    <div class="add_mechanism" @click="addMechanism(3)" v-if="mechanismArr.length == 2">
                        <van-image :src="tianjia"></van-image>
                        <div class="title">添加机制</div>
                    </div>
                </div>
                <div v-if="mechanismArr.indexOf(3) !== -1">
                    <div class="mechanism_title">
                        机制三
                        <div class="delete_mechanism" @click="deleteMechanism(3)">
                            <van-image :src="shanchu"></van-image>
                            <div class="title">删除机制</div>
                        </div>
                    </div>
                    <van-cell-group inset>
                        <van-field input-align="right" error-message-align="right" name="cooperationMode3" label="合作方式"
                            v-model="addQueryParams.cooperationMode3" is-link readonly placeholder="请选择"
                            @click="showCooperationMode3 = true" :rules="[
                                { required: false, trigger: 'onBlur', message: '请选择合作方式' },
                            ]" />
                        <van-popup v-model:show="showCooperationMode3" position="bottom">
                            <van-picker title="合作方式" :columns="cooperationModeColumns"
                                @confirm="onConfirmcooperationMode3" @cancel="showCooperationMode3 = false" />
                        </van-popup>
                    </van-cell-group>
                    <formNumberKeyboard :formRef="formRef" v-if="addQueryParams.cooperationMode3 == '分佣'" name="price3"
                        label="售价" :required="addQueryParams.cooperationMode3 == '分佣'"
                        v-model:keyValue="addQueryParams.price3" placeholder="请输入" :rules="[
                            { validator: validators3, message: '请输入售价' },
                            {
                                validator: validatorNumber2,
                                message: '请输入正确内容：整数或者保留两位小数',
                            },
                        ]" extraKey="." />
                    <van-cell-group inset v-if="addQueryParams.cooperationMode3 == '分佣'">
                        <van-field input-align="right" error-message-align="right" name="costPrice3" label="成本"
                            v-model="addQueryParams.costPrice3" readonly required placeholder="请输入" />
                    </van-cell-group>
                    <formNumberKeyboard v-else :formRef="formRef" name="costPrice3" label="成本"
                        :required="addQueryParams.cooperationMode3 == '供货'" v-model:keyValue="addQueryParams.costPrice3"
                        placeholder="请输入" :rules="[
                            {
                                validator: validatorNumbercostPrice3,
                                message: '请输入正确内容：整数或者保留两位小数',
                            },
                        ]" extraKey="." />
                    <formNumberKeyboard :formRef="formRef" v-if="addQueryParams.cooperationMode3 == '分佣'"
                        name="commission3" label="佣金" :required="addQueryParams.cooperationMode3 == '分佣'"
                        v-model:keyValue="addQueryParams.commission3" placeholder="请输入" :rules="[
                            { validator: validators3, message: '请输入佣金' },
                            {
                                validator: validatorcommission2,
                                message: '请输入正确内容：整数或者保留两位小数',
                            },
                        ]" extraKey=".">
                        %
                    </formNumberKeyboard>
                    <formNumberKeyboard :formRef="formRef" v-if="addQueryParams.cooperationMode3 == '分佣'"
                        name="brokerage3" label="补充佣金" v-model:keyValue="addQueryParams.brokerage3" placeholder="请输入"
                        :rules="[
                            {
                                validator: validatorbrokerage3,
                                message: '请输入正确内容：整数或者保留两位小数',
                            },
                        ]" extraKey=".">
                        %
                    </formNumberKeyboard>
                    <van-cell-group inset>
                        <van-field input-align="right" error-message-align="right" name="liveStreamingMechanism3"
                            label="机制" maxlength="12" v-model="addQueryParams.liveStreamingMechanism3"
                            @input="(e) => { forbidRule(e, 'liveStreamingMechanism3', 'blank') }" placeholder="请输入"
                            :required="!!addQueryParams.cooperationMode3" :rules="[
                                { validator: validators3, message: '请输入机制' },
                            ]" />
                    </van-cell-group>
                </div>

                <van-cell-group inset>
                    <van-field input-align="right" error-message-align="right" name="discountPrice" label="能否破价"
                        v-model="addQueryParams.discountPrice" is-link readonly placeholder="请选择"
                        @click="showDiscountPrice = true" required :rules="[
                            { required: true, trigger: 'onBlur', message: '请选择能否破价' },
                        ]" />
                    <van-popup v-model:show="showDiscountPrice" position="bottom">
                        <van-picker title="能否破价" :columns="discountPriceColumns" @confirm="onConfirmDiscountPrice"
                            @cancel="showDiscountPrice = false" />
                    </van-popup>
                </van-cell-group>
                <van-cell-group inset>
                    <van-field input-align="right" error-message-align="right" name="specs" label="规格/材质" :rules="[
                        { required: false, trigger: 'onBlur', message: '请输入规格/材质名称' },
                    ]" v-model="addQueryParams.specs" placeholder="请输入" maxlength="200"
                        @input="(e) => { forbidRule(e, 'specs', 'emoji') }" />
                </van-cell-group>
                <!-- <van-cell-group inset>
                    <van-field input-align="right" error-message-align="right" name="ingredient" label="材质" :rules="[
                        { required: false, trigger: 'onBlur', message: '请输入材质名称' },
                    ]" v-model="addQueryParams.ingredient" placeholder="请输入" maxlength="50"
                        @input="(e) => { forbidRule(e, 'ingredient', 'emoji') }" />
                </van-cell-group> -->
                <van-cell-group inset>
                    <van-field name="warehouse" label="走仓" input-align="right" error-message-align="right">
                        <template #input>
                            <van-switch v-model="addQueryParams.warehouse" />
                        </template>
                    </van-field>
                </van-cell-group>
                <van-cell-group inset>
                    <van-field v-model="addQueryParams.sellingPoints" input-align="right" error-message-align="right"
                        maxlength="189" rows="1" autosize label="卖点"
                        @input="(e) => { forbidRule(e, 'sellingPoints', 'emoji') }" placeholder="请输入卖点" required :rules="[
                            { required: true, trigger: 'onBlur', message: '请输入卖点' }
                        ]" />
                </van-cell-group>
                <van-cell-group inset>
                    <van-field v-model="addQueryParams.groupName" input-align="right" error-message-align="right"
                        maxlength="20" autosize label="对接群名" @input="(e) => { forbidRule(e, 'groupName', 'emoji') }"
                        placeholder="请输入对接群名" :rules="[
                            { required: false, trigger: 'onBlur', message: '请输入对接群名' }
                        ]" />
                </van-cell-group>
                <div class="image-title">
                    商品图
                </div>
                <van-cell-group inset>
                    <van-field name="商品图" label="" v-model="addQueryParams.productImage">
                        <template #input>
                            <div class="value">
                                <div v-for="(item, index) in productImageList" :key="index" class="imgList">
                                    <div class="loading_pic" v-if="!item.url">
                                        <van-loading type="spinner" size="20" />
                                    </div>
                                    <van-image v-if="item.url" :src="item.url"
                                        @click="enlargeImage(item.url)"></van-image>
                                    <van-icon v-if="item.url" name="cross" color="#fff" @click.prevent="
                                        deleteImg(
                                            productImageList,
                                            index,
                                        )
                                        " />
                                </div>
                                <van-image :src="upload" v-if="productImageList.length < 5"
                                    @click="postImage('productImage', 5)" v-throttle:click></van-image>
                            </div>
                        </template>
                    </van-field>
                </van-cell-group>
                <div class="image-title">
                    备案凭证/行政许可批件
                </div>
                <van-cell-group inset>
                    <van-field name="备案凭证/行政许可批件" label="" v-model="addQueryParams.voucherImage">
                        <template #input>
                            <div class="value">
                                <div v-for="(item, index) in voucherImageList" :key="index" class="imgList">
                                    <div class="loading_pic" v-if="!item.url">
                                        <van-loading type="spinner" size="20" />
                                    </div>
                                    <van-image v-if="item.url" :src="item.url"
                                        @click="enlargeImage(item.url)"></van-image>
                                    <van-icon v-if="item.url" name="cross" color="#fff" @click.prevent="
                                        deleteImg(
                                            voucherImageList,
                                            index,
                                        )
                                        " />
                                </div>
                                <van-image :src="upload" v-if="voucherImageList.length < 5"
                                    @click="postImage('voucherImage', 5)" v-throttle:click></van-image>
                            </div>
                        </template>
                    </van-field>
                </van-cell-group>
                <div class="image-title">
                    其他资质
                </div>
                <van-cell-group inset>
                    <van-field name="其他资质" label="" v-model="addQueryParams.otherImage">
                        <template #input>
                            <div class="value">
                                <div v-for="(item, index) in otherImageList" :key="index" class="imgList">
                                    <div class="loading_pic" v-if="!item.url">
                                        <van-loading type="spinner" size="20" />
                                    </div>
                                    <van-image v-if="item.url" :src="item.url"
                                        @click="enlargeImage(item.url)"></van-image>
                                    <van-icon v-if="item.url" name="cross" color="#fff" @click.prevent="
                                        deleteImg(
                                            otherImageList,
                                            index,
                                        )
                                        " />
                                </div>
                                <van-image :src="upload" v-if="otherImageList.length < 5"
                                    @click="postImage('otherImage', 5)" v-throttle:click></van-image>
                            </div>
                        </template>
                    </van-field>
                </van-cell-group>
                <div class="image-title" v-if="addQueryParams.tradeMode == '进口'">
                    进口货物/原材料报关单
                </div>
                <van-cell-group inset>
                    <van-field name="进口货物/原材料报关单" label="" v-model="addQueryParams.customsDeclarationImage"
                        v-if="addQueryParams.tradeMode == '进口'">
                        <template #input>
                            <div class="value">
                                <div v-for="(item, index) in customsDeclarationImageList" :key="index" class="imgList">
                                    <div class="loading_pic" v-if="!item.url">
                                        <van-loading type="spinner" size="20" />
                                    </div>
                                    <van-image v-if="item.url" :src="item.url"
                                        @click="enlargeImage(item.url)"></van-image>
                                    <van-icon v-if="item.url" name="cross" color="#fff" @click.prevent="
                                        deleteImg(
                                            customsDeclarationImageList,
                                            index,
                                        )
                                        " />
                                </div>
                                <van-image :src="upload" v-if="customsDeclarationImageList.length < 5"
                                    @click="postImage('customsDeclarationImage', 5)" v-throttle:click></van-image>
                            </div>
                        </template>
                    </van-field>
                </van-cell-group>
                <div class="image-title" v-if="addQueryParams.tradeMode == '进口'">
                    进口产品备案材料
                </div>
                <van-cell-group inset>
                    <van-field name="进口产品备案材料" label="" v-model="addQueryParams.customsInformationImage"
                        v-if="addQueryParams.tradeMode == '进口'">
                        <template #input>
                            <div class="value">
                                <div v-for="(item, index) in customsInformationImageList" :key="index" class="imgList">
                                    <div class="loading_pic" v-if="!item.url">
                                        <van-loading type="spinner" size="20" />
                                    </div>
                                    <van-image v-if="item.url" :src="item.url"
                                        @click="enlargeImage(item.url)"></van-image>
                                    <van-icon v-if="item.url" name="cross" color="#fff" @click.prevent="
                                        deleteImg(
                                            customsInformationImageList,
                                            index,
                                        )
                                        " />
                                </div>
                                <van-image :src="upload" v-if="customsInformationImageList.length < 5"
                                    @click="postImage('customsInformationImage', 5)" v-throttle:click></van-image>
                            </div>
                        </template>
                    </van-field>
                </van-cell-group>
                <div class="image-title" v-if="addQueryParams.tradeMode == '进口'">
                    进口产品原材料检验检疫证明
                </div>
                <van-cell-group inset>
                    <van-field name="进口产品原材料检验检疫证明" label="" v-model="addQueryParams.customsInspectionImage"
                        v-if="addQueryParams.tradeMode == '进口'">
                        <template #input>
                            <div class="value">
                                <div v-for="(item, index) in customsInspectionImageList" :key="index" class="imgList">
                                    <div class="loading_pic" v-if="!item.url">
                                        <van-loading type="spinner" size="20" />
                                    </div>
                                    <van-image v-if="item.url" :src="item.url"
                                        @click="enlargeImage(item.url)"></van-image>
                                    <van-icon v-if="item.url" name="cross" color="#fff" @click.prevent="
                                        deleteImg(
                                            customsInspectionImageList,
                                            index,
                                        )
                                        " />
                                </div>
                                <van-image :src="upload" v-if="customsInspectionImageList.length < 5"
                                    @click="postImage('customsInspectionImage', 5)" v-throttle:click></van-image>
                            </div>
                        </template>
                    </van-field>
                </van-cell-group>
                <div class="image-title" v-if="addQueryParams.tradeMode == '进口'">
                    检测报告
                </div>
                <van-cell-group inset>
                    <van-field name="检测报告" label="" v-if="addQueryParams.tradeMode == '进口'"
                        v-model="addQueryParams.customsTestReportImgae">
                        <template #input>
                            <div class="value">
                                <div v-for="(item, index) in customsTestReportImgaeList" :key="index" class="imgList">
                                    <div class="loading_pic" v-if="!item.url">
                                        <van-loading type="spinner" size="20" />
                                    </div>
                                    <van-image v-if="item.url" :src="item.url"
                                        @click="enlargeImage(item.url)"></van-image>
                                    <van-icon v-if="item.url" name="cross" color="#fff" @click.prevent="
                                        deleteImg(
                                            customsTestReportImgaeList,
                                            index,
                                        )
                                        " />
                                </div>
                                <van-image :src="upload" v-if="customsTestReportImgaeList.length < 5"
                                    @click="postImage('customsTestReportImgae', 5)" v-throttle:click></van-image>
                            </div>
                        </template>
                    </van-field>
                </van-cell-group>
                <div style="width: 100%; bottom: 0; margin-top: 30px">
                    <van-button round block type="primary" native-type="submit" v-throttle:click>
                        保存
                    </van-button>
                </div>
            </van-form>
        </div>
    </div>
    <div v-if="showSupplierName"
        style="position: absolute;width: 100%;height: 100vh;top: 0;left: 0;background: #fff;z-index: 999;">
        <SupplierScreen :isShow="showSupplierName" @cancel="showSupplierName = false" @submit="onConfirmSupplierName" />
    </div>
    <Point :show="isPoint" v-model:costPrice="addQueryParams.costPrice" v-model:costPrice2="addQueryParams.costPrice2"
        v-model:costPrice3="addQueryParams.costPrice3" :mechanismArr="mechanismArr" :data="addQueryParams"
        @clone="isPoint = false" />
</template>
<script setup lang="ts">
import {
    getDicts,
    addHmProducts,
    getCategoryList,
} from "@/api/productList/index";
import { showSuccessToast } from "vant";
import { onUnmounted, ref, watchEffect } from "vue";
import { useRouter } from "vue-router";
import { loginStore } from "@/store/login";
import { storeToRefs } from "pinia";
import { showImagePreview } from "vant";
import { getEnvValue } from "@/utils/index";
import SupplierScreen from '@/components/SupplierScreen/index.vue'
import formNumberKeyboard from "@/components/formNumberKeyboard/index.vue";
import Point from './components/point.vue'
import PointButton from './components/pointButton.vue'
import { handleImageUpdate } from "@/utils/handleImageUpdate";
const upload = new URL("@/assets/home/upload.png", import.meta.url).href;
const tianjia = new URL("@/assets/productHome/icon_tianjia1.png", import.meta.url).href;
const shanchu = new URL("@/assets/productHome/icon_shanchu.png", import.meta.url).href;
const store = loginStore();
const formRef = ref()
const { token } = storeToRefs(store);
const router = useRouter();
const checked = ref([]);
const addQueryParams = ref({
    supplierName: "",
    styleName: "",
    category: "",
    brandName: "",
    styleCode: "",
    sellingPoints: "",
    tradeMode: "",
    cooperationMode: "",
    price: "",
    costPrice: "",
    liveStreamingMechanism: "",
    commission: "",
    brokerage: "",
    productCategoryName: "",
    categoryId: "",

    cooperationMode2: "",
    price2: "",
    costPrice2: "",
    liveStreamingMechanism2: "",
    commission2: "",
    brokerage2: "",

    cooperationMode3: "",
    price3: "",
    costPrice3: "",
    liveStreamingMechanism3: "",
    commission3: "",
    brokerage3: "",

    discountPrice: "",
    supplierId: "",
    productImage: "",
    voucherImage: "",
    otherImage: "",
    customsDeclarationImage: "",
    customsInformationImage: "",
    customsInspectionImage: "",
    customsTestReportImgae: "",
    specs: "",
    // ingredient: "",
    warehouse: false,
    groupName: "",
    tax: '',
});
const isPoint = ref(false)      // 扣点弹框开关
const productImageList = ref<any[]>([]);
const voucherImageList = ref<any[]>([]);
const otherImageList = ref<any[]>([]);
const customsDeclarationImageList = ref<any[]>([]);
const customsInformationImageList = ref<any[]>([]);
const customsInspectionImageList = ref<any[]>([]);
const customsTestReportImgaeList = ref<any[]>([]);

const showSupplierName = ref(false);

const show = ref(false);
const cascaderValue = ref('');
const options = ref();
const showTradeMode = ref(false);
const tradeModeColumns = ref([]);
const showCooperationMode = ref(false);
const showCooperationMode2 = ref(false);
const showCooperationMode3 = ref(false);
const cooperationModeColumns = ref([]);
const showDiscountPrice = ref(false);
const discountPriceColumns = ref([]);

// 集合
const mechanismArr = ref([1])

watchEffect(() => {
    if (addQueryParams.value.cooperationMode === '分佣') {
        let costPrice = Number(addQueryParams.value.price || 0) * (1 - ((Number(addQueryParams.value.commission || 0) / 100) + (Number(addQueryParams.value.brokerage || 0) / 100) + (Number(addQueryParams.value.tax || 0) / 100)))
        addQueryParams.value.costPrice = costPrice.toFixed(2)
    }
    if (addQueryParams.value.cooperationMode2 === '分佣') {
        let costPrice2 = Number(addQueryParams.value.price2 || 0) * (1 - ((Number(addQueryParams.value.commission2 || 0) / 100) + (Number(addQueryParams.value.brokerage2 || 0) / 100) + (Number(addQueryParams.value.tax || 0) / 100)))
        addQueryParams.value.costPrice2 = costPrice2.toFixed(2)
    }
    if (addQueryParams.value.cooperationMode3 === '分佣') {
        let costPrice3 = Number(addQueryParams.value.price3 || 0) * (1 - ((Number(addQueryParams.value.commission3 || 0) / 100) + (Number(addQueryParams.value.brokerage3 || 0) / 100) + (Number(addQueryParams.value.tax || 0) / 100)))
        addQueryParams.value.costPrice3 = costPrice3.toFixed(2)
    }
})


const validatorStyleCode = (val) => {
    if (val) {
        return /^[0-9]{3,13}$/.test(val)
    } else {
        return true
    }
}
const validatorNumber = (val) => {
    return /(^(?!0\d)([1-9]\d{0,8}(\.\d{1,2})?|0(\.\d{1,2})?)$)/.test(val);
}

const validatorNumbercostPrice = (val: any) => {
    if (addQueryParams.value.cooperationMode == '分佣') {
        if (val) {
            return /(^(?!0\d)([1-9]\d{0,8}(\.\d{1,2})?|0(\.\d{1,2})?)$)/.test(val);
        } else {
            return true
        }
    } else if (addQueryParams.value.cooperationMode == '') {
        return true
    } else {
        return /(^(?!0\d)([1-9]\d{0,8}(\.\d{1,2})?|0(\.\d{1,2})?)$)/.test(val);
    }
}

// 机制二机制三  分佣时非必填 为空时非必填 供货时必填
const validatorNumbercostPrice2 = (val) => {
    if (addQueryParams.value.cooperationMode2 == '分佣') {
        if (val) {
            return /(^(?!0\d)([1-9]\d{0,8}(\.\d{1,2})?|0(\.\d{1,2})?)$)/.test(val);
        } else {
            return true
        }
    } else if (addQueryParams.value.cooperationMode2 == '') {
        return true
    } else {
        return /(^(?!0\d)([1-9]\d{0,8}(\.\d{1,2})?|0(\.\d{1,2})?)$)/.test(val);
    }
}
const validatorNumbercostPrice3 = (val) => {
    if (addQueryParams.value.cooperationMode3 == '分佣') {
        if (val) {
            return /(^(?!0\d)([1-9]\d{0,8}(\.\d{1,2})?|0(\.\d{1,2})?)$)/.test(val);
        } else {
            return true
        }
    } else if (addQueryParams.value.cooperationMode3 == '') {
        return true
    } else {
        return /(^(?!0\d)([1-9]\d{0,8}(\.\d{1,2})?|0(\.\d{1,2})?)$)/.test(val);
    }
}
// const validatorNumbers = (val) => /^[\u4e00-\u9fa5a-zA-Z0-9]+$/.test(val);
const validatorNumberBrand = (val) => {
    if (val) {
        return /^[\u0020-\u007e\u4e00-\u9fa5]+$/.test(val);
    } else {
        return true
    }
}
const validators2 = (value) => {
    if (addQueryParams.value.cooperationMode2) {
        if (value) {
            return true
        } else {
            return false
        }
    } else {
        return true
    }
}
const validators3 = (value) => {
    if (addQueryParams.value.cooperationMode3) {
        if (value) {
            return true
        } else {
            return false
        }
    } else {
        return true
    }
}
const validatorNumber2 = (val) => {
    if (val) {
        return /(^(?!0\d)([1-9]\d{0,8}(\.\d{1,2})?|0(\.\d{1,2})?)$)/.test(val);
    } else {
        return true
    }
}

const validatorcommission2 = (val) => {
    if (val) {
        return /^(([1-9]?\d(\.\d{1,2})?)|100|100.00)$/.test(val);
    } else {
        return true
    }
}

const validatorcommission = (val) => /^(([1-9]?\d(\.\d{1,2})?)|100|100.00)$/.test(val);
const validatorbrokerage = (val) => {
    if (addQueryParams.value.cooperationMode == '分佣') {
        if (val) {
            return /^(([1-9]?\d(\.\d{1,2})?)|100|100.00)$/.test(val);
        } else {
            return true
        }
    } else {
        return false
    }
}
const validatorbrokerage2 = (val) => {
    if (addQueryParams.value.cooperationMode2 == '分佣') {
        if (val) {
            return /^(([1-9]?\d(\.\d{1,2})?)|100|100.00)$/.test(val);
        } else {
            return true
        }
    } else {
        return false
    }
}
const validatorbrokerage3 = (val) => {
    if (addQueryParams.value.cooperationMode3 == '分佣') {
        if (val) {
            return /^(([1-9]?\d(\.\d{1,2})?)|100|100.00)$/.test(val);
        } else {
            return true
        }
    } else {
        return false
    }
}

// 输入事件、禁用规则
const forbidRule = (e: any, key: string, type: string) => {
    // 输入法表情默认不能输入
    if (type == 'emoji') {
        // emoji：输入时禁用输入法表情
        addQueryParams.value[key] = e.target.value.replace(/[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\u00A9|\u00AE|\u3030/gi, '')
    } else if (type == 'blank') {
        // blank：输入时禁用空格
        addQueryParams.value[key] = e.target.value.replace(/\s|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\u00A9|\u00AE|\u3030/gi, '')
    }
}

/** 添加机制 */
const addMechanism = (index: number) => {
    mechanismArr.value.push(index)
}
/** 删除机制 */
const deleteMechanism = (index: number) => {
    // 当机制二删除并且机制三也存在得情况 删除机制三 保留机制二
    if (index == 2 && mechanismArr.value.length == 3) {
        mechanismArr.value.splice(2, 1)
        addQueryParams.value.cooperationMode2 = addQueryParams.value.cooperationMode3
        addQueryParams.value.price2 = addQueryParams.value.price3
        addQueryParams.value.costPrice2 = addQueryParams.value.costPrice3
        addQueryParams.value.liveStreamingMechanism2 = addQueryParams.value.liveStreamingMechanism3
        addQueryParams.value.commission2 = addQueryParams.value.commission3
        addQueryParams.value.brokerage2 = addQueryParams.value.brokerage3

        addQueryParams.value.cooperationMode3 = ""
        addQueryParams.value.price3 = ""
        addQueryParams.value.costPrice3 = ""
        addQueryParams.value.liveStreamingMechanism3 = ""
        addQueryParams.value.commission3 = ""
        addQueryParams.value.brokerage3 = ""
    } else {
        let indexs = mechanismArr.value.indexOf(index)
        mechanismArr.value.splice(indexs, 1)
        if (index == 2) {
            addQueryParams.value.cooperationMode2 = ""
            addQueryParams.value.price2 = ""
            addQueryParams.value.costPrice2 = ""
            addQueryParams.value.liveStreamingMechanism2 = ""
            addQueryParams.value.commission2 = ""
            addQueryParams.value.brokerage2 = ""
        } else if (index == 3) {
            addQueryParams.value.cooperationMode3 = ""
            addQueryParams.value.price3 = ""
            addQueryParams.value.costPrice3 = ""
            addQueryParams.value.liveStreamingMechanism3 = ""
            addQueryParams.value.commission3 = ""
            addQueryParams.value.brokerage3 = ""
        }
    }
}

/** 获取类目 */
const getOptions = async () => {
    try {
        const res = await getCategoryList();
        const processedData = renameField(res.data);
        options.value = processedData;
    } catch (error) {
        console.error('Failed to get category list:', error);
        options.value = [];
    }
};
const renameField = (arr: any[]) => {
    return arr.filter(item => item.categoryStatus === 0).map(element => {
        if (element.children) {
            element.children = renameField(element.children);
            if (element.children.length === 0) {
                delete element.children;
            }
        }
        return {
            text: element.categoryName,
            value: element.categoryId,
            ...element,
        };
    });
}
getOptions();

/** 供应商名称关闭 */
const onConfirmSupplierName = (options: any) => {
    showSupplierName.value = false;
    if (options) {
        addQueryParams.value.supplierName = options.supplierName
        addQueryParams.value.supplierId = options.id;
    }
};

/** 回退 */
const handleLeft = () => {
    router.push('/home')
}

/** 贸易方式 */
const getTradeMode = async () => {
    const res = await getDicts("hm_trade_type");
    res.data.forEach((element) => {
        element.text = element.dictLabel;
        element.value = element.dictValue;
    });
    tradeModeColumns.value = res.data;
};
getTradeMode();
/** 贸易方式关闭 */
const onConfirmTradeMode = ({ selectedOptions }) => {
    addQueryParams.value.tradeMode = selectedOptions[0]?.text;
    showTradeMode.value = false;
};
/** 合作方式 */
const getcooperationMode = async () => {
    const res = await getDicts("hm_cooperation_mode");
    res.data.forEach((element) => {
        element.text = element.dictLabel;
        element.value = element.dictValue;
    });
    cooperationModeColumns.value = res.data;
};
getcooperationMode();
/** 合作方式关闭 */
const onConfirmcooperationMode = ({ selectedOptions }) => {
    addQueryParams.value.costPrice = ''
    addQueryParams.value.cooperationMode = selectedOptions[0]?.text;
    showCooperationMode.value = false;
};
/** 合作方式关闭 */
const onConfirmcooperationMode2 = ({ selectedOptions }) => {
    addQueryParams.value.costPrice2 = ''
    addQueryParams.value.cooperationMode2 = selectedOptions[0]?.text;
    showCooperationMode2.value = false;
};
/** 合作方式关闭 */
const onConfirmcooperationMode3 = ({ selectedOptions }) => {
    addQueryParams.value.costPrice3 = ''
    addQueryParams.value.cooperationMode3 = selectedOptions[0]?.text;
    showCooperationMode3.value = false;
};
/** 能否破价 */
const getDiscountPrice = async () => {
    const res = await getDicts("hm_discount");
    res.data.forEach((element) => {
        element.text = element.dictLabel;
        element.value = element.dictValue;
    });
    discountPriceColumns.value = res.data;
};
getDiscountPrice();
/** 能否破价关闭 */
const onConfirmDiscountPrice = ({ selectedOptions }) => {
    addQueryParams.value.discountPrice = selectedOptions[0]?.text;
    showDiscountPrice.value = false;
};

/** 类目修改 */
const cascaderShade = ref(false)
const cascaderTimeout = ref()

/** 类目最后选择 */
const onFinish = (value) => {
    show.value = false;
    addQueryParams.value.productCategoryName = value.selectedOptions
        .map((option) => option.text)
        .join(",");
    addQueryParams.value.categoryId = value.selectedOptions
        .map((option) => option.value)
        .join(",");
};
/** 离开页面、提交移除本地存储 */
const removeLocal = () => {
    // 删除app切换导致得缓存数据问题 清除
    localStorage.removeItem('addQueryParams')
    productImageList.value && localStorage.removeItem('productImageList')
    voucherImageList.value && localStorage.removeItem('voucherImageList')
    otherImageList.value && localStorage.removeItem('otherImageList')
    customsDeclarationImageList.value && localStorage.removeItem('customsDeclarationImageList')
    customsInformationImageList.value && localStorage.removeItem('customsInformationImageList')
    customsInspectionImageList.value && localStorage.removeItem('customsInspectionImageList')
    customsTestReportImgaeList.value && localStorage.removeItem('customsTestReportImgaeList')
    addQueryParams.value = {
        supplierName: "",
        styleName: "",
        category: "",
        productCategoryName: "",
        categoryId: "",
        brandName: "",
        styleCode: "",
        sellingPoints: "",
        tradeMode: "",
        cooperationMode: "",
        price: "",
        costPrice: "",
        liveStreamingMechanism: "",
        commission: "",
        brokerage: "",
        discountPrice: "",
        supplierId: "",
        productImage: "",
        voucherImage: "",
        otherImage: "",
        customsDeclarationImage: "",
        customsInformationImage: "",
        customsInspectionImage: "",
        customsTestReportImgae: "",
        specs: "",
        // ingredient: "",
        warehouse: false,
        groupName: "",

        cooperationMode2: "",
        price2: "",
        costPrice2: "",
        liveStreamingMechanism2: "",
        commission2: "",
        brokerage2: "",

        cooperationMode3: "",
        price3: "",
        costPrice3: "",
        liveStreamingMechanism3: "",
        commission3: "",
        brokerage3: "",

        tax: '',
    }
    productImageList.value = []
    voucherImageList.value = []
    otherImageList.value = []
    customsDeclarationImageList.value = []
    customsInformationImageList.value = []
    customsInspectionImageList.value = []
    customsTestReportImgaeList.value = []
}
/**
 * 图片全路径转半路径
 * @param list 
 */
const getPicByfullPath = (list: any[]) => {
    if (list.length > 0) {
        const updatedList = list.map((item: any) => {
            return item.url.split(getEnvValue("VITE_APP_PIC_URL"))[1];
        });
        return updatedList.join(',');
    } else {
        return '';
    }
}
const onSubmit = async () => {
    const list = JSON.parse(JSON.stringify(addQueryParams.value));
    list.productImage = getPicByfullPath(productImageList.value)
    list.voucherImage = getPicByfullPath(voucherImageList.value)
    list.otherImage = getPicByfullPath(otherImageList.value)
    list.customsDeclarationImage = getPicByfullPath(customsDeclarationImageList.value)
    list.customsInformationImage = getPicByfullPath(customsInformationImageList.value)
    list.customsInspectionImage = getPicByfullPath(customsInspectionImageList.value)
    list.customsTestReportImgae = getPicByfullPath(customsTestReportImgaeList.value)
    list.warehouse = list.warehouse ? 1 : 0
    if (list.cooperationMode == "供货") {
        delete list.price;
        delete list.commission
        delete list.brokerage
    }
    if (list.cooperationMode2 == "供货") {
        delete list.price2;
        delete list.commission2
        delete list.brokerage2
    }
    if (list.cooperationMode3 == "供货") {
        delete list.price3;
        delete list.commission3
        delete list.brokerage3
    }
    list.hmMechanismsList = [
        { cooperationMode: list.cooperationMode, commission: list.commission, price: list.price, costPrice: list.costPrice, brokerage: list.brokerage, liveStreamingMechanism: list.liveStreamingMechanism },
        { cooperationMode: list.cooperationMode2, commission: list.commission2, price: list.price2, costPrice: list.costPrice2, brokerage: list.brokerage2, liveStreamingMechanism: list.liveStreamingMechanism2 },
        { cooperationMode: list.cooperationMode3, commission: list.commission3, price: list.price3, costPrice: list.costPrice3, brokerage: list.brokerage3, liveStreamingMechanism: list.liveStreamingMechanism3 },

    ]
    if (checked.value.length > 0) {
        list.styleCode = ''
    }
    await addHmProducts(list);
    showSuccessToast({ type: "success", message: "新增商品成功" });
    removeLocal();
    router.back();
};

/** 删除 */
const deleteImg = (list: any, index: number) => {
    list.splice(index, 1);
};
/** app端隐藏触发保存表单 */
(window as any).saveState = function (arg) {
    if (arg.action == 'save') {
        localStorage.setItem("addQueryParams", JSON.stringify(addQueryParams.value));
        localStorage.setItem("mechanismArr", JSON.stringify(mechanismArr.value));
        if (productImageList.value.length > 0) {
            localStorage.setItem("productImageList", JSON.stringify(productImageList.value));
        }
        if (voucherImageList.value.length > 0) {
            localStorage.setItem("voucherImageList", JSON.stringify(voucherImageList.value));
        }
        if (otherImageList.value.length > 0) {
            localStorage.setItem("otherImageList", JSON.stringify(otherImageList.value));
        }
        if (customsDeclarationImageList.value.length > 0) {
            localStorage.setItem("customsDeclarationImageList", JSON.stringify(customsDeclarationImageList.value));
        }
        if (customsInformationImageList.value.length > 0) {
            localStorage.setItem("customsInformationImageList", JSON.stringify(customsInformationImageList.value));
        }
        if (customsInspectionImageList.value.length > 0) {
            localStorage.setItem("customsInspectionImageList", JSON.stringify(customsInspectionImageList.value));
        }
        if (customsTestReportImgaeList.value.length > 0) {
            localStorage.setItem("customsTestReportImgaeList", JSON.stringify(customsTestReportImgaeList.value));
        }
    }
}
onUnmounted(() => {
    removeLocal();
    clearTimeout(cascaderTimeout.value)
})
/** app端重新打开后数据保存重新渲染 */
const rendering = () => {
    if (localStorage.getItem('addQueryParams')) {
        addQueryParams.value = JSON.parse(localStorage.getItem('addQueryParams') as string)
    }
    if (localStorage.getItem('mechanismArr')) {
        mechanismArr.value = JSON.parse(localStorage.getItem('mechanismArr') as string)
    }
    if (localStorage.getItem('productImageList')) {
        productImageList.value = JSON.parse(localStorage.getItem('productImageList') as string)
    }
    if (localStorage.getItem('voucherImageList')) {
        voucherImageList.value = JSON.parse(localStorage.getItem('voucherImageList') as string)
    }
    if (localStorage.getItem('otherImageList')) {
        otherImageList.value = JSON.parse(localStorage.getItem('otherImageList') as string)
    }
    if (localStorage.getItem('customsDeclarationImageList')) {
        customsDeclarationImageList.value = JSON.parse(localStorage.getItem('customsDeclarationImageList') as string)
    }
    if (localStorage.getItem('customsInformationImageList')) {
        customsInformationImageList.value = JSON.parse(localStorage.getItem('customsInformationImageList') as string)
    }
    if (localStorage.getItem('customsInspectionImageList')) {
        customsInspectionImageList.value = JSON.parse(localStorage.getItem('customsInspectionImageList') as string)
    }
    if (localStorage.getItem('customsTestReportImgaeList')) {
        customsTestReportImgaeList.value = JSON.parse(localStorage.getItem('customsTestReportImgaeList') as string)
    }

}
rendering()
/** 图片放大 */
const enlargeImage = (img: string) => {
    if (img) {
        showImagePreview({
            images: [img],
        });
    }
};
(window as any).msgFromUniapp = function (arg) {
    const imageLists = {
        productImage: productImageList.value,
        voucherImage: voucherImageList.value,
        otherImage: otherImageList.value,
        customsDeclarationImage: customsDeclarationImageList.value,
        customsInformationImage: customsInformationImageList.value,
        customsInspectionImage: customsInspectionImageList.value,
        customsTestReportImgae: customsTestReportImgaeList.value
    };

    const maxCounts = {
        productImage: 5,
        voucherImage: 5,
        otherImage: 10,
        customsDeclarationImage: 5,
        customsInformationImage: 5,
        customsInspectionImage: 5,
        customsTestReportImgae: 5
    };

    const imageList = imageLists[arg.name];
    const maxCount = maxCounts[arg.name];

    handleImageUpdate(imageList, arg, maxCount);
};
const postImage = (name: string, count: number) => {
    (window as any).uni.webView.postMessage({
        data: {
            type: "img",
            count: count,
            name: name,
            url: getEnvValue("VITE_APP_UPLOAD_API") + '/resource/oss/upload',
            header: {
                Authorization: `Bearer ${token.value}`,
                clientid: "e5cd7e4891bf95d1d19206ce24a7b32e",
            },
        },
    });
};
</script>
<style lang="less" scoped>
.cascaderShade {
    width: 100%;
    height: 100%;
    position: absolute;
    z-index: 9999;
}

:deep(.van-nav-bar__left .van-icon) {
    color: #1a1b1c !important;
}

.add_product {
    background-color: #f6faff;
    width: 100%;
    height: calc(100vh - 90px);
    //   height: 100vh;
    box-sizing: border-box;
    padding: 10px 15px 60px 15px;
    overflow-y: scroll;
}

.add_supplier-background {
    background-color: #fff;

    .mechanism_title {
        // width: 100%;
        font-weight: 600;
        font-size: 14px;
        color: #1A1B1C;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin: 10px 15px 10px 15px;

        .delete_mechanism {
            width: 128px;
            height: 34px;
            border-radius: 22px;
            border: 1px solid #FC2540;
            display: flex;
            justify-content: center;
            align-items: center;
            font-weight: 400;
            font-size: 14px;
            color: #FC2540;

            .van-image {
                width: 14px;
                height: 14px;
            }
        }
    }

    .add_mechanism {
        width: 128px;
        height: 34px;
        border-radius: 22px;
        border: 1px solid #0094FF;
        display: flex;
        justify-content: center;
        align-items: center;
        font-weight: 400;
        font-size: 14px;
        color: #0094FF;
        margin: auto;

        .van-image {
            width: 14px;
            height: 14px;
        }
    }
}

:deep(.van-cell-group--inset) {
    margin: 0 !important;
    border-radius: 0 !important;
}

.label {
    width: 90px;
    margin-right: 12px;
}

.value {
    width: 100%;
    display: flex;
    flex-wrap: wrap;

    .imgList {
        position: relative;

        .loading_pic {
            width: 90px;
            height: 90px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        :deep(.van-image__img) {
            margin-right: 5px;
        }

        :deep(.van-icon) {
            position: absolute;
            top: 0;
            z-index: 100;
            right: 4px;
            font-size: 10px;
            height: 15px;
            width: 15px;
            background-color: #000;
            border-bottom-left-radius: 16px;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        :deep(.van-icon-cross:before) {
            margin: 0 0 1px 2px;
        }
    }

    :deep(.van-image__img) {
        width: 77px;
        height: 77px;
    }
}

:deep(.van-form) {
    // padding-bottom: 35px !important;
    background-color: #fff;
}

:deep(.van-popup--bottom) {
    border-radius: 20px 20px 0px 0px !important;
}

:deep(.van-picker-column__item--selected>.van-ellipsis) {
    color: #0094ff;
}

.image-title {
    font-weight: 400;
    font-size: 14px;
    color: #1a1b1c;
    background-color: #fff;
    padding-left: 15px;
}

// van-badge__wrapper van-icon van-icon-arrow van-cell__right-icon</style>
